<!--
 * @Author:shuaishuai
-->
<template>
  <div class="left-content-box">
    <div class="pageTitle">全社会用电量与发电量</div>
    <div class="contentItem">
      <div class="titleBox">
        <div class="title">全社会用电量与发电量</div>

        <div ref="pieChart" style="width: 2100px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem">
      <div class="titleBox" ref="titleBox">
        <div class="title">活力发电需求</div>
        <DialogCustom ref="dialogCustomRef" v-model="isShow" :floatStyles="floatStyles" />
        <div ref="pieChart2" style="width: 2100px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem">
      <div class="titleBox">
        <div class="title">全社会清洁能源发电量</div>
        <div ref="pieChart3" style="width: 2100px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem">
      <div class="titleBox">
        <div class="title">燃煤发电需求</div>
        <div ref="pieChart4" style="width: 2100px; height: 790px"></div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import * as echarts from 'echarts'
import { defineComponent } from 'vue'
import DialogCustom from '@/views/page2/home/pageTwo/components/DialogCustom.vue'
export default defineComponent({
  data() {
    return {
      isShow: false,
      floatStyles: {
        top: 0,
        left: 0
      },
      blueLabelBg: require('@/assets/images/blueLabelBg.png'),
      YelloLabelBg: require('@/assets/images/YelloLabelBg.png')
    }
  },
  components: {
    DialogCustom
  },
  created() {},
  mounted() {
    this.getChart()
    this.getChartTwo()
    this.getChartThree()
    this.getChartFour()
  },
  methods: {
    getChart() {
      let chart = echarts.init(this.$refs.pieChart)
      let bar01color = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
        {
          offset: 0,
          color: 'rgba(42, 216, 228, 1)'
        },
        {
          offset: 1,
          color: 'rgba(20, 157, 220, 0)'
        }
      ])
      let bar02color = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
        {
          offset: 0,
          color: 'rgba(190, 255, 110, 1)'
        },
        {
          offset: 1,
          color: 'rgba(20, 157, 220, 0)'
        }
      ])
      var option = {
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor.colorStops[0].color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },
        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: 200,
          padding: '0 0 10 0',
          containLabel: true
        },
        legend: {
          //图例组件，颜色和名字
          top: '10%',
          // bottom:20,
          itemGap: 30,
          itemWidth: 20,
          itemHeight: 20,
          // data: ['煤', '石油', '天然气', '电力'],
          textStyle: {
            color: '#fff',
            fontStyle: 'normal',
            fontFamily: '微软雅黑',
            fontSize: 40
          }
        },
        xAxis: [
          {
            type: 'category',
            boundaryGap: true, //坐标轴两边留白
            data: ['2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
            axisLabel: {
              //坐标轴刻度标签的相关设置。
              interval: 0, //设置为 1，表示『隔一个标签显示一个标签』
              margin: 15,
              textStyle: {
                color: '#fff',
                fontStyle: 'normal',
                fontFamily: '微软雅黑',
                fontSize: 40
              }
            },
            axisTick: {
              //坐标轴刻度相关设置。
              show: false
            },
            axisLine: {
              //坐标轴轴线相关设置
              lineStyle: {
                color: '#fff',
                opacity: 0.2
              }
            },
            splitLine: {
              show: true,
              // interval: information.area.length,
              lineStyle: {
                color: 'rgba(180, 228, 255, 0.1)',
                width: 2
              }
            }
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '万亿千瓦时',
            nameGap: 25,
            splitLine: {
              show: false
            },
            nameTextStyle: {
              color: 'white',
              fontSize: 40,
              padding: [0, 0, 10, -60]
            },
            axisLabel: {
              fontSize: 40,
              color: 'white'
            },
            axisLine: {
              lineStyle: {
                // 坐标线
                type: 'solid',
                color: 'rgba(0, 0, 0, 0.5)', // 轴的颜 色
                width: '1' // 坐标线宽度
              }
            }
          },
          {
            name: '%',
            // max: maxR,
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, 20]
            },

            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            },
            splitLine: {
              show: true,
              lineStyle: {
                color: 'rgba(255, 255, 255, 0.2)'
              }
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            }
          }
        ],
        series: [
          {
            name: '发电量',
            type: 'bar',
            data: [2, 1, 2, 3, 1, 2, 3, 5],
            barWidth: 33,
            barGap: 1, //柱间距离

            itemStyle: {
              //图形样式
              normal: {
                borderColor: bar01color,
                borderWidth: 3,
                color: function (params) {
                  return params.name == '2024' ? 'rgba(0, 0, 0, 0)' : bar01color // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                },
                barBorderRadius: 11
              }
            }
          },
          {
            name: '用电量',
            type: 'bar',
            data: [5, 5, 7, 8, 4, 5, 7, 6],
            barWidth: 33,
            barGap: 1, //柱间距离
            itemStyle: {
              //图形样式
              normal: {
                borderColor: bar02color,
                borderWidth: 3,
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : bar02color // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                },
                barBorderRadius: 11
              }
            }
            // label: {
            //   show: true,
            //   position: 'outside',
            //   width: 144,
            //   height: 65,
            //   color: "rgba(66, 252, 255, 1)",
            //   fontSize: 40,
            //   lineHeight: 70,
            //   // backgroundColor: {
            //   //   image: this.blueLabelBg
            //   // },
            //   formatter: function (params) {
            //     if (params.name == '2024' && params.seriesName == '用电量') {
            //       return params.value; // 显示标签
            //     } else {
            //       return ''; // 其他数据点不显示标签
            //     }
            //   }
            // },
          },
          {
            z: 9,
            yAxisIndex: 1,
            name: '发电量增速',
            type: 'line',
            // symbolSize: [10, 10],
            color: 'rgba(255, 87, 51, 1)',
            lineStyle: {
              color: 'rgba(255, 87, 51, 1)',
              width: 5
            },

            data: [88, 86, 87, 82, 84, 85, 95, 22]
          },
          {
            z: 9,
            yAxisIndex: 1,
            name: '用电量增速',
            type: 'line',
            // symbolSize: [10, 10],
            color: 'rgba(255, 236, 112, 1)',
            lineStyle: {
              color: 'rgba(255, 236, 112, 1)',
              width: 5
            },
            // label: {
            //   show: true,
            //   position: 'outside',
            //   width: 144,
            //   height: 65,
            //   color: "rgba(255, 195, 0, 1)",
            //   fontSize: 40,
            //   lineHeight: 70,
            //   // backgroundColor: {
            //   //   image: this.YelloLabelBg
            //   // },
            //   formatter: function (params) {
            //     if (params.name == '2024' && params.seriesName == '用电量增速') {
            //       // let html = `<p class="bg">${params.value}</p>`
            //       // return html
            //       return params.value
            //     } else {
            //       return ''; // 其他数据点不显示标签
            //     }
            //   }
            // },
            data: [66, 43, 5, 44, 53, 24, 54, 44]
          }
        ]
      }
      chart.setOption(option, true)
    },
    getChartTwo() {
      let chart = echarts.init(this.$refs.pieChart2)
      let colorData = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
        {
          offset: 0,
          color: 'rgba(41, 215, 227, 1)'
        },
        {
          offset: 1,
          color: 'rgba(0, 85, 255, 0)'
        }
      ])
      let option = {
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor.colorStops[0].color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },
        legend: {
          // data: ["能源消费总量", "能耗强度"],
          top: '10%',
          textStyle: {
            fontSize: 40,
            color: '#fff',
            padding: [0, 8]
          }
        },
        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: 200,
          padding: '0 0 10 0',
          containLabel: true
        },
        xAxis: {
          data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
          triggerEvent: true,
          axisTick: {
            show: false
          },
          axisLine: {
            show: false
          },
          axisLabel: {
            show: true,
            rotate: 0,
            interval: 0,
            textStyle: {
              padding: [14, 0, 0, 0],
              fontSize: 40,
              color: '#fff'
            }
          },
          splitLine: {
            show: true,
            // interval: information.area.length,
            lineStyle: {
              color: 'rgba(180, 228, 255, 0.1)',
              width: 2
            }
          }
        },
        yAxis: [
          {
            type: 'value',
            name: '万亿千瓦时',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          },
          {
            type: 'value',
            name: '%',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            position: 'right',
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          }
        ],
        series: [
          {
            name: '发电量',
            // barMinHeight: 10,
            type: 'pictorialBar',
            barCategoryGap: '30%',
            symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
            itemStyle: {
              normal: {
                borderColor: colorData,
                borderWidth: 5,
                //渐变色
                // color: colorData
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : colorData // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            data: [70, 60, 80, 20, 30, 44, 53, 67, 32, 23]
            // z: 10,
          },
          {
            name: '增速',
            type: 'line',
            yAxisIndex: 1, //使用的 y 轴的 index，在单个图表实例中存在多个 y轴的时候有用
            // smooth: true, //平滑曲线显示
            showAllSymbol: true, //显示所有图形。
            symbol: 'circle', //标记的图形为实心圆
            symbolSize: 20, //标记的大小
            itemStyle: {
              //折线拐点标志的样式
              color: 'rgba(255, 195, 0, 1)',
              borderColor: '#fff',
              borderWidth: 5
            },
            lineStyle: {
              color: 'rgba(255, 195, 0, 1)',
              width: 5
            },
            data: [42, 38, 48, 35, 29, 28, 3, 5, 99, 122]
          }
          // {
          //   name: "hill",
          //   type: "bar",
          //   barWidth: "20%",
          //   symbol: "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z",
          //   itemStyle: {
          //     normal: {
          //       color: "rgba(11,47,68,.2)",
          //     },
          //   },
          //   data: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
          //   z: 9,
          // },
        ]
      }
      // 监听body点击事件
      document.body.addEventListener('click', () => {
        if(this.isShow){
          this.isShow = false
        }
      },true)

      chart.getZr().on('click', (params) => {
        this.isShow = false
        const x = params.offsetX
        const y = params.offsetY
        this.floatStyles.left = x + 'px'
        this.floatStyles.top = y + 'px'
        this.isShow = true
        this.$nextTick(() => {
          this.$refs.dialogCustomRef.updateChart()
        })
      })
      chart.setOption(option, true)
    },
    getChartThree() {
      let chart = echarts.init(this.$refs.pieChart3)
      let option = {
        tooltip: {
          top: '10%',
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },

        grid: {
          top: 200,
          left: '5%',
          right: '5%',
          bottom: '5%',
          containLabel: true
        },
        legend: {
          top: '10%',
          itemWidth: 20,
          itemHeight: 20,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff'
            // padding: [0, 8],
          }
          // data: ["化工行业", "有色金属行业", "石化行业", "建材行业", "钢铁行业", "造纸和纸制品行业"],
        },
        xAxis: [
          {
            type: 'category',
            data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
            axisTick: {
              show: false
            },
            axisLine: {
              lineStyle: {
                color: '#666'
              }
            },
            axisLabel: {
              interval: 0,
              align: 'center',
              margin: 10,
              color: '#fff',
              rotate: 0,
              textStyle: {
                fontSize: 40
              }
            },
            splitLine: {
              show: true,
              // interval: information.area.length,
              lineStyle: {
                color: 'rgba(180, 228, 255, 0.1)',
                width: 2
              }
            }
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '万亿千瓦时',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 28
              }
            }
          },
          {
            type: 'value',
            name: '%',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            position: 'right',
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          }
        ],
        series: [
          {
            name: '太阳能',
            stack: '渠道1',
            type: 'bar',
            barWidth: 70,
            color: function (params) {
              return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(68, 197, 207, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
            },
            itemStyle: {
              //图形样式
              normal: {
                borderWidth: 3,
                borderColor: 'rgba(68, 197, 207, 1)',
                // color: "rgba(68, 197, 207, 1)"
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(68, 197, 207, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            data: [310, 20, 50, 106, 169, 160, 157, 220, 232, 201]
          },
          {
            name: '风能',
            stack: '渠道1',
            type: 'bar',
            barWidth: 70,
            color: function (params) {
              return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(127, 94, 204, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
            },
            itemStyle: {
              //图形样式
              normal: {
                borderWidth: 3,
                borderColor: 'rgba(127, 94, 204, 1)',
                // color: "rgba(127, 94, 204, 1)"
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(127, 94, 204, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            data: [310, 20, 50, 106, 169, 160, 157, 220, 232, 201]
          },
          {
            name: '水力',
            stack: '渠道1',
            type: 'bar',
            barWidth: 70,
            color: function (params) {
              return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(217, 187, 91, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
            },
            itemStyle: {
              //图形样式
              normal: {
                borderWidth: 3,
                borderColor: 'rgba(217, 187, 91, 1)',
                // color: "rgba(217, 187, 91, 1)"
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(217, 187, 91, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            data: [310, 20, 50, 106, 169, 160, 157, 220, 232, 201, 154]
          },
          {
            name: '核能',
            stack: '渠道1',
            type: 'bar',
            barWidth: 70,
            color: function (params) {
              return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(89, 171, 217, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
            },
            itemStyle: {
              //图形样式
              normal: {
                borderWidth: 3,
                borderColor: 'rgba(89, 171, 217, 1)',
                // color: "rgba(89, 171, 217, 1)"
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(89, 171, 217, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            data: [320, 332, 301, 334, 390, 330, 320, 120, 232, 201]
          },
          {
            z: 9,
            yAxisIndex: 1,
            name: '增速',
            type: 'line',
            // symbolSize: [10, 10],
            color: 'rgba(255, 195, 0, 1)',
            lineStyle: {
              color: 'rgba(255, 195, 0, 1)',
              width: 5
            },
            data: [66, 43, 5, 44, 53, 24, 54, 44, 33, 22]
          }
        ]
      }
      chart.setOption(option, true)
    },
    getChartFour() {
      let chart = echarts.init(this.$refs.pieChart4)
      let option = {
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },
        toolbox: {
          right: 20,
          feature: {
            magicType: {
              type: ['line']
            },
            restore: {},
            saveAsImage: {}
            // brush: {},
          }
        },
        grid: {
          top: 200,
          left: '5%',
          right: '5%',
          bottom: '5%',
          containLabel: true
        },
        legend: {
          top: '10%',
          itemWidth: 20,
          itemHeight: 20,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff'
            // padding: [0, 8],
          }
          // data: ["化工行业", "有色金属行业", "石化行业", "建材行业", "钢铁行业", "造纸和纸制品行业"],
        },
        xAxis: [
          {
            type: 'category',
            data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
            axisTick: {
              show: false
            },
            axisLine: {
              lineStyle: {
                color: '#666'
              }
            },
            axisLabel: {
              interval: 0,
              align: 'center',
              margin: 10,
              color: '#fff',
              rotate: 0,
              textStyle: {
                fontSize: 40
              }
            },
            splitLine: {
              show: true,
              // interval: information.area.length,
              lineStyle: {
                color: 'rgba(180, 228, 255, 0.1)',
                width: 2
              }
            }
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '万亿千瓦时',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 28
              }
            }
          },
          {
            type: 'value',
            name: '%',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            position: 'right',
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          }
        ],
        series: [
          {
            name: '发电量',
            stack: '渠道1',
            type: 'bar',
            barWidth: 43,
            itemStyle: {
              //图形样式
              normal: {
                borderColor: 'rgba(83, 238, 252, 0.2)',
                borderWidth: 3,
                // color: "rgba(83, 238, 252, 0.2)"
                color: function (params) {
                  return params.name == '2024' ? 'rgba(83, 238, 252, 0)' : 'rgba(83, 238, 252, 0.2)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            data: [310, 20, 50, 106, 169, 160, 157, 220, 232, 201]
          },
          {
            name: '发电量',
            stack: '渠道1',
            type: 'bar',
            silent: true,
            tooltip: {
              show: false
            },
            barWidth: 43,
            barMinHeight: 12,
            itemStyle: {
              //图形样式
              normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    offset: 0,
                    color: 'rgba(132, 225, 255, 1)'
                  },
                  {
                    offset: 1,
                    color: 'rgba(81, 125, 238, 1)'
                  }
                ])
              }
            },
            data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
          },
          {
            z: 9,
            yAxisIndex: 1,
            name: '增速',
            type: 'line',
            // smooth: true, //平滑曲线显示
            showAllSymbol: true, //显示所有图形。
            symbol: 'circle', //标记的图形为实心圆
            symbolSize: 20, //标记的大小
            itemStyle: {
              //折线拐点标志的样式
              color: 'rgba(255, 195, 0, 1)',
              borderColor: '#fff',
              borderWidth: 5
            },
            lineStyle: {
              color: 'rgba(255, 195, 0, 1)',
              width: 5
            },
            data: [66, 43, 5, 44, 53, 24, 54, 44, 33, 22]
          }
        ]
      }
      chart.setOption(option, true)
    }
  }
})
</script>

<style lang="scss" scoped>
.left-content-box {
  width: 4339px;
  height: 1830px;
  // height: 1700px;
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  margin: 0 200px;

  .pageTitle {
    width: 4339px;
    text-align: center;
    position: absolute;
    color: #fff;
    font-size: 60px;
    margin-top: -186px;
    height: 120px;
    line-height: 120px;
  }

  .contentItem {
    flex: 1;
    width: calc(50% - 190px);
    height: calc(50% - 90px);
    min-width: 50%;
    max-width: 50%;
    padding: 20px;
    box-sizing: border-box;

    .titleBox {
      position: relative;
      width: 2100px;
      line-height: 10px;
      text-align: center;

      .title {
        height: 100%;
        font-size: 53px;
        color: #fff;
      }
    }
  }

  .bg {
    background: url('@/assets/images/YelloLabelBg.png');
    background-size: 100% 100%;
    width: 144px;
    height: 65px;
  }
}
</style>
